//
//  YunDanDetailIconHeader.m
//  阿帕
//
//  Created 阿帕 on 2019/12/27.
//  Copyright © 2019 GCY. All rights reserved.
//

#import "YunDanDetailIconHeader.h"

@interface YunDanDetailIconHeader ()

@property(nonatomic, strong)UIButton *iconButton;

@end

@implementation YunDanDetailIconHeader

#pragma mark - Intial
- (instancetype)initWithFrame:(CGRect)frame {
    
    self = [super initWithFrame:frame];
    if (self) {
        
        [self setUpUI];
    }
    return self;
}

- (void)setUpUI {
    
    _iconButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [_iconButton setTitleColor:Dark_TextColor forState:UIControlStateNormal];
    [_iconButton setTitle:@"-" forState:UIControlStateNormal];
    _iconButton.titleLabel.font = font(15);
    _iconButton.frame = CGRectMake(15, 0, 200, self.height);
    _iconButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    [_iconButton setImage:image(@"") forState:UIControlStateNormal];
    [self addSubview:_iconButton];
    [_iconButton layoutButtonWithEdgeInsetsStyle:MKButtonEdgeInsetsStyleLeft imageTitleSpace:5];
}

- (void)setIconInfoArray:(NSArray *)iconInfoArray {
    
    _iconInfoArray = iconInfoArray;
    
    [_iconButton setImage:image([iconInfoArray firstObject]) forState:UIControlStateNormal];

    [_iconButton setTitle:[iconInfoArray lastObject] forState:UIControlStateNormal];

}

@end
